/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.playground.core.entity;

import java.util.Date;

/**
 *
 * @author Tiago Peres
 */
public class LoggedPlayer extends Player implements Cloneable {    
    private PlayerStatus status;
    private final String key;
    private final Date connectedSince;
    private Date lastAction;
    // A logged player, when playing, or in queue, is linked to a room. Only one game can be played or queued at a time.
    private Room room;
    
    public LoggedPlayer(Long id, String key){
        setId(id);
        this.key = key;
        connectedSince = new Date();
        lastAction = new Date();
    }

    public PlayerStatus getStatus() {
        return status;
    }

    public void setStatus(PlayerStatus status) {
        this.status = status;
    }

    public String getKey() {
        return key;
    }

    public Date getConnectedSince() {
        return connectedSince;
    }

    public Date getLastAction() {
        return lastAction;
    }

    public void setLastAction(Date lastAction) {
        this.lastAction = lastAction;
    }

    public Room getRoom() {
        return room;
    }

    public void setRoom(Room room) {
        this.room = room;
    }
    
    @Override
    public LoggedPlayer clone() throws CloneNotSupportedException{
        return (LoggedPlayer) super.clone();
    }
}
